<?php

/**
 * Created by IntelliJ IDEA.
 * User: keke
 * Date: 18-10-27
 * Time: 下午12:24
 */
require_once "../congfig/config.php";
require_once "../lib/common.php";

$pid = $_GET['pid'];
$sql = "SELECT * FROM proinfor  WHERE id = '$pid'";
$query = $conn->query($sql);
$result = $query->fetch_array();
$filepa = $result['Enclosure'];
$filepa = filepath . "$filepa";
if (file_exists($filepa)) {
    unlink($filepa);
}
$sql = "DELETE FROM goodpro where pid = '$pid'";
$query = $conn->query($sql);
$sql = "DELETE FROM puser where pid = '$pid'";
$query = $conn->query($sql);
if (!$query) {
    exit(jsoncall(-1, "删除成员失败"));
}
$sql = "DELETE FROM proinfor where id = '$pid'";
$query = $conn->query($sql);
if ($query) {
    exit(jsoncall(1, "删除项目成功"));
} else {
    exit(jsoncall(-1, "删除项目失败"));
}